package ofc4j.util;

import ofc4j.model.elements.HorizontalBarChart;
import ofc4j.model.elements.HorizontalBarChart.Bar;

import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.io.path.PathTrackingWriter;

public class HorizontalBarChartBarConverter extends ConverterBase<Bar> {
    @Override
    @SuppressWarnings("unchecked")
    public boolean canConvert(Class c) {
        return HorizontalBarChart.Bar.class.isAssignableFrom(c);
    }
    
    @Override
    public void convert(Bar o, PathTrackingWriter writer, MarshallingContext mc) {
        writeNode(writer, "right", o.getRight());
        writeNode(writer, "left", o.getLeft());
    }
}
